package wc.controller.factory;

import java.util.*;
import wc.model.component.*;
import wc.model.component.roomcomponent.*;
import wc.model.grid.*;

public class ToiletRoomFactory extends UtilityRoomFactory {
	private static ToiletRoomFactory instance = null;
	private ToiletRoomComponentFactory trcf = null;
	
	private ToiletRoomFactory() {
		trcf = ToiletRoomComponentFactory.getInstance();
	}
	
	public static ToiletRoomFactory getInstance() {
		if(instance == null) {
			instance = new ToiletRoomFactory();
		}
		return instance;
	}
	
	public ToiletRoom createToiletRoom(int width, int height) {
		TileGrid<Component> relativeLocations = new TileGrid<Component>(width, height);
		TileGrid<RoomComponent> roomComponents = new TileGrid<RoomComponent>(width, height);
		List<RoomComponent> mustPlaceComponents = new ArrayList<RoomComponent>();
		mustPlaceComponents.add(trcf.createToilet());
		mustPlaceComponents.add(trcf.createToiletDoor());
		ToiletRoom toiletRoom = new ToiletRoom(relativeLocations, roomComponents, mustPlaceComponents);
		relativeLocations.setComponent(toiletRoom);
		return toiletRoom;
	}
}
